import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import store from './vuex/index'
import "babel-polyfill";
import Vuex from 'vuex'
import routes from './routes'

import ElementUI from 'element-ui';

Vue.use(ElementUI);

import './styles/styles.scss'
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(Vuex)
Vue.use(VueRouter)


const router = new VueRouter({
	routes
})
router.beforeEach((to, from, next) => {
	let sessionConfig = JSON.parse(sessionStorage.getItem('a_config')) || {};
	if(to.path == '/payList' && sessionConfig.appId){
		next();
	}else if(to.path == '/payList' && !sessionConfig.appId){
		next('/login');
		return false
	}
	next();
})

new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app')